Skip to content

Fix/dependent methods #694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 6, 2015
Merged

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jun 25, 2015

Some fixes related to implicit resolution which make some more tests go through. In particular, typelevel Peano numbers. Review by @adriaanm maybe?

odersky added 6 commits June 23, 2015 11:49
Previously, we could die with a <notype> when an implicit argument was not found.
Now handles included test if toplevel implicit is given, but not yet without.
The term in a SearchSuccess has already been adapted to the expected type.
…icits

Nothing will be committed here, so setExplore... is the right method to pick.
Necessary to make implicit resolution of type-level peano numbers work.
The current commit makes takes the inimal steps to make this happen. We
could also consider sharpening using followAlias every type we constrain
a result, or every time we adapt a type.
@odersky
Copy link
Contributor Author

odersky commented Jun 25, 2015

Other depmeth tests in pos/pending still give errors. Needs more investigation.

val constraint = ctx.typerState.constraint
def inst(tp: Type): Type = tp match {
case TypeBounds(lo, hi) =>
if ((lo eq hi) || (hi <:< lo)(ctx.fresh.setExploreTyperState)) inst(lo) else NoType
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment explaining why NoType instead of tp makes sense here?

@odersky
Copy link
Contributor Author

odersky commented Jun 25, 2015

@smarter

mt.paramTypes.map(_ => WildcardType)

is even shorter (and I think clearer than either solution). I wrote the const to save a closure.

@retronym
Copy link
Member

Sadly, Function.const(x) still needs eta expansion and a new closure as it is a method with two param lists, rather than a method with one param list that returns a Function.

@odersky
Copy link
Contributor Author

odersky commented Jun 26, 2015

@retronym Ah, that got probably done when we introduced specialization. So, no need to use Function.const. We can drop them at some point in the future.

odersky added a commit that referenced this pull request Jul 6, 2015
@odersky odersky merged commit 70f18eb into scala:master Jul 6, 2015
@allanrenucci allanrenucci deleted the fix/dependent-methods branch December 14, 2017 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants